package IO;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class ObjectInputStreamBasicTypeDemo {
    public static void main(String[] args) {
        ObjectInputStream ois = null;
        try{
            ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream("d:/basictypedata.txt")));
            System.out.println("int:"+ois.readInt());
            System.out.println("float:"+ois.readFloat());
            System.out.println("char:"+ois.readChar());
            System.out.println("boolean:"+ois.readBoolean());
            System.out.println("String:"+ois.readUTF());

        }catch (Exception e){
            e.printStackTrace();
        }finally{
            try{
                if(ois != null){
                    ois.close();
                }
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }
}
